
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Javascript教程 - 基本语法 - 小白AI.易名</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="Javascript教程"><meta name="keywords" content="小白AI.易名,xiaobaiai.net,Javascript,入门,教程,博客">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="小白AI.易名">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-page-footer-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../types/" />
    
    
    <link rel="prev" href="history.html" />
    

    
        <link rel="shortcut icon" href='../../assets/images/favicon.ico' type="image/x-icon">
    
    
        <link rel="bookmark" href='../../assets/images/favicon.ico' type="image/x-icon">
    
    
        <link rel="apple-touch-icon" href='../../assets/images/apple-touch-icon.png'>
    
    
        
        <link rel="apple-touch-icon" sizes="120x120" href="../../assets/images/apple-touch-icon-120x120.png">
        
        <link rel="apple-touch-icon" sizes="180x180" href="../../assets/images/apple-touch-icon-180x180.png">
        
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="./">
            
                <a href="./">
            
                    
                    入门篇
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="introduction.html">
            
                <a href="introduction.html">
            
                    
                    导论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="history.html">
            
                <a href="history.html">
            
                    
                    历史
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.3" data-path="grammar.html">
            
                <a href="grammar.html">
            
                    
                    基本语法
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../types/">
            
                <a href="../types/">
            
                    
                    数据类型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../types/general.html">
            
                <a href="../types/general.html">
            
                    
                    概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../types/null-undefined-boolean.html">
            
                <a href="../types/null-undefined-boolean.html">
            
                    
                    null,undefined和布尔值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../types/number.html">
            
                <a href="../types/number.html">
            
                    
                    数值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../types/string.html">
            
                <a href="../types/string.html">
            
                    
                    字符串
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../types/object.html">
            
                <a href="../types/object.html">
            
                    
                    对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../types/function.html">
            
                <a href="../types/function.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../types/array.html">
            
                <a href="../types/array.html">
            
                    
                    数组
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../operators/">
            
                <a href="../operators/">
            
                    
                    运算符
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../operators/arithmetic.html">
            
                <a href="../operators/arithmetic.html">
            
                    
                    算术运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../operators/comparison.html">
            
                <a href="../operators/comparison.html">
            
                    
                    比较运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../operators/boolean.html">
            
                <a href="../operators/boolean.html">
            
                    
                    布尔运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../operators/bit.html">
            
                <a href="../operators/bit.html">
            
                    
                    二进制位运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../operators/priority.html">
            
                <a href="../operators/priority.html">
            
                    
                    其他运算符，运算顺序
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../features/">
            
                <a href="../features/">
            
                    
                    语法专题
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../features/conversion.html">
            
                <a href="../features/conversion.html">
            
                    
                    数据类型的转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../features/error.html">
            
                <a href="../features/error.html">
            
                    
                    错误处理机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../features/style.html">
            
                <a href="../features/style.html">
            
                    
                    编程风格
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../features/console.html">
            
                <a href="../features/console.html">
            
                    
                    console 对象与控制台
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../stdlib/">
            
                <a href="../stdlib/">
            
                    
                    标准库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../stdlib/object.html">
            
                <a href="../stdlib/object.html">
            
                    
                    Object 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../stdlib/attributes.html">
            
                <a href="../stdlib/attributes.html">
            
                    
                    属性描述对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../stdlib/array.html">
            
                <a href="../stdlib/array.html">
            
                    
                    Array 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../stdlib/wrapper.html">
            
                <a href="../stdlib/wrapper.html">
            
                    
                    包装对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../stdlib/boolean.html">
            
                <a href="../stdlib/boolean.html">
            
                    
                    Boolean 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../stdlib/number.html">
            
                <a href="../stdlib/number.html">
            
                    
                    Number 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../stdlib/string.html">
            
                <a href="../stdlib/string.html">
            
                    
                    String 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../stdlib/math.html">
            
                <a href="../stdlib/math.html">
            
                    
                    Math 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../stdlib/date.html">
            
                <a href="../stdlib/date.html">
            
                    
                    Date 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="../stdlib/regexp.html">
            
                <a href="../stdlib/regexp.html">
            
                    
                    RegExp 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11" data-path="../stdlib/json.html">
            
                <a href="../stdlib/json.html">
            
                    
                    JSON 对象
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../oop/">
            
                <a href="../oop/">
            
                    
                    面向对象编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../oop/new.html">
            
                <a href="../oop/new.html">
            
                    
                    实例对象与 New 命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../oop/this.html">
            
                <a href="../oop/this.html">
            
                    
                    this 关键字
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../oop/prototype.html">
            
                <a href="../oop/prototype.html">
            
                    
                    对象的继承
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../oop/object.html">
            
                <a href="../oop/object.html">
            
                    
                    Object 对象的相关方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../oop/strict.html">
            
                <a href="../oop/strict.html">
            
                    
                    严格模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../async/">
            
                <a href="../async/">
            
                    
                    异步操作
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../async/general.html">
            
                <a href="../async/general.html">
            
                    
                    概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../async/timer.html">
            
                <a href="../async/timer.html">
            
                    
                    定时器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../async/promise.html">
            
                <a href="../async/promise.html">
            
                    
                    Promise 对象
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../dom/">
            
                <a href="../dom/">
            
                    
                    DOM
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../dom/general.html">
            
                <a href="../dom/general.html">
            
                    
                    概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../dom/node.html">
            
                <a href="../dom/node.html">
            
                    
                    Node 接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../dom/nodelist.html">
            
                <a href="../dom/nodelist.html">
            
                    
                    NodeList 接口，HTMLCollection 接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../dom/parentnode.html">
            
                <a href="../dom/parentnode.html">
            
                    
                    ParentNode 接口，ChildNode 接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" data-path="../dom/document.html">
            
                <a href="../dom/document.html">
            
                    
                    Document 节点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.6" data-path="../dom/element.html">
            
                <a href="../dom/element.html">
            
                    
                    Element 节点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.7" data-path="../dom/attributes.html">
            
                <a href="../dom/attributes.html">
            
                    
                    属性的操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.8" data-path="../dom/text.html">
            
                <a href="../dom/text.html">
            
                    
                    Text 节点和 DocumentFragment 节点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.9" data-path="../dom/css.html">
            
                <a href="../dom/css.html">
            
                    
                    CSS 操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.10" data-path="../dom/mutationobserver.html">
            
                <a href="../dom/mutationobserver.html">
            
                    
                    Mutation Observer API
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../events/">
            
                <a href="../events/">
            
                    
                    事件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../events/eventtarget.html">
            
                <a href="../events/eventtarget.html">
            
                    
                    EventTarget 接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../events/model.html">
            
                <a href="../events/model.html">
            
                    
                    事件模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../events/event.html">
            
                <a href="../events/event.html">
            
                    
                    Event 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../events/mouse.html">
            
                <a href="../events/mouse.html">
            
                    
                    鼠标事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../events/keyboard.html">
            
                <a href="../events/keyboard.html">
            
                    
                    键盘事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../events/progress.html">
            
                <a href="../events/progress.html">
            
                    
                    进度事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../events/form.html">
            
                <a href="../events/form.html">
            
                    
                    表单事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" data-path="../events/touch.html">
            
                <a href="../events/touch.html">
            
                    
                    触摸事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.9" data-path="../events/drag.html">
            
                <a href="../events/drag.html">
            
                    
                    拖拉事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.10" data-path="../events/common.html">
            
                <a href="../events/common.html">
            
                    
                    其他常见事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.11" data-path="../events/globaleventhandlers.html">
            
                <a href="../events/globaleventhandlers.html">
            
                    
                    GlobalEventHandlers 接口
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../bom/">
            
                <a href="../bom/">
            
                    
                    浏览器模型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../bom/engine.html">
            
                <a href="../bom/engine.html">
            
                    
                    浏览器模型概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../bom/window.html">
            
                <a href="../bom/window.html">
            
                    
                    window 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../bom/navigator.html">
            
                <a href="../bom/navigator.html">
            
                    
                    Navigatror 对象，Screen 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.4" data-path="../bom/cookie.html">
            
                <a href="../bom/cookie.html">
            
                    
                    Cookie
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.5" data-path="../bom/xmlhttprequest.html">
            
                <a href="../bom/xmlhttprequest.html">
            
                    
                    XMLHttpRequest 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.6" data-path="../bom/same-origin.html">
            
                <a href="../bom/same-origin.html">
            
                    
                    同源限制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.7" data-path="../bom/cors.html">
            
                <a href="../bom/cors.html">
            
                    
                    CORS 通信
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.8" data-path="../bom/storage.html">
            
                <a href="../bom/storage.html">
            
                    
                    Storage 接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.9" data-path="../bom/history.html">
            
                <a href="../bom/history.html">
            
                    
                    History 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.10" data-path="../bom/location.html">
            
                <a href="../bom/location.html">
            
                    
                    Location对象，URL对象，URLSearchParams 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.11" data-path="../bom/arraybuffer.html">
            
                <a href="../bom/arraybuffer.html">
            
                    
                    ArrayBuffer 对象，Blob对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.12" data-path="../bom/file.html">
            
                <a href="../bom/file.html">
            
                    
                    File 对象，FileList 对象，FileReader 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.13" data-path="../bom/form.html">
            
                <a href="../bom/form.html">
            
                    
                    表单，FormData 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.14" data-path="../bom/indexeddb.html">
            
                <a href="../bom/indexeddb.html">
            
                    
                    IndexedDB API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.15" data-path="../bom/webworker.html">
            
                <a href="../bom/webworker.html">
            
                    
                    web worker
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../elements/">
            
                <a href="../elements/">
            
                    
                    附录:网页元素接口
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../elements/a.html">
            
                <a href="../elements/a.html">
            
                    
                    a超链接
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../elements/image.html">
            
                <a href="../elements/image.html">
            
                    
                    image图片
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.3" data-path="../elements/form.html">
            
                <a href="../elements/form.html">
            
                    
                    form表单
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.4" data-path="../elements/input.html">
            
                <a href="../elements/input.html">
            
                    
                    input文本框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.5" data-path="../elements/button.html">
            
                <a href="../elements/button.html">
            
                    
                    button按钮
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.6" data-path="../elements/option.html">
            
                <a href="../elements/option.html">
            
                    
                    option选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.7" data-path="../elements/video.html">
            
                <a href="../elements/video.html">
            
                    
                    video,audio音视频
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="_blank" rel="nofollow" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >基本语法</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="javascript-&#x7684;&#x57FA;&#x672C;&#x8BED;&#x6CD5;">JavaScript &#x7684;&#x57FA;&#x672C;&#x8BED;&#x6CD5;</h1>
<h2 id="&#x8BED;&#x53E5;">&#x8BED;&#x53E5;</h2>
<p>JavaScript &#x7A0B;&#x5E8F;&#x7684;&#x6267;&#x884C;&#x5355;&#x4F4D;&#x4E3A;&#x884C;&#xFF08;line&#xFF09;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x4E00;&#x884C;&#x4E00;&#x884C;&#x5730;&#x6267;&#x884C;&#x3002;&#x4E00;&#x822C;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x6BCF;&#x4E00;&#x884C;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x8BED;&#x53E5;&#x3002;</p>
<p>&#x8BED;&#x53E5;&#xFF08;statement&#xFF09;&#x662F;&#x4E3A;&#x4E86;&#x5B8C;&#x6210;&#x67D0;&#x79CD;&#x4EFB;&#x52A1;&#x800C;&#x8FDB;&#x884C;&#x7684;&#x64CD;&#x4F5C;&#xFF0C;&#x6BD4;&#x5982;&#x4E0B;&#x9762;&#x5C31;&#x662F;&#x4E00;&#x884C;&#x8D4B;&#x503C;&#x8BED;&#x53E5;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> a = <span class="hljs-number">1</span> + <span class="hljs-number">3</span>;
</code></pre>
<p>&#x8FD9;&#x6761;&#x8BED;&#x53E5;&#x5148;&#x7528;<code>var</code>&#x547D;&#x4EE4;&#xFF0C;&#x58F0;&#x660E;&#x4E86;&#x53D8;&#x91CF;<code>a</code>&#xFF0C;&#x7136;&#x540E;&#x5C06;<code>1 + 3</code>&#x7684;&#x8FD0;&#x7B97;&#x7ED3;&#x679C;&#x8D4B;&#x503C;&#x7ED9;&#x53D8;&#x91CF;<code>a</code>&#x3002;</p>
<p><code>1 + 3</code>&#x53EB;&#x505A;&#x8868;&#x8FBE;&#x5F0F;&#xFF08;expression&#xFF09;&#xFF0C;&#x6307;&#x4E00;&#x4E2A;&#x4E3A;&#x4E86;&#x5F97;&#x5230;&#x8FD4;&#x56DE;&#x503C;&#x7684;&#x8BA1;&#x7B97;&#x5F0F;&#x3002;&#x8BED;&#x53E5;&#x548C;&#x8868;&#x8FBE;&#x5F0F;&#x7684;&#x533A;&#x522B;&#x5728;&#x4E8E;&#xFF0C;&#x524D;&#x8005;&#x4E3B;&#x8981;&#x4E3A;&#x4E86;&#x8FDB;&#x884C;&#x67D0;&#x79CD;&#x64CD;&#x4F5C;&#xFF0C;&#x4E00;&#x822C;&#x60C5;&#x51B5;&#x4E0B;&#x4E0D;&#x9700;&#x8981;&#x8FD4;&#x56DE;&#x503C;&#xFF1B;&#x540E;&#x8005;&#x5219;&#x662F;&#x4E3A;&#x4E86;&#x5F97;&#x5230;&#x8FD4;&#x56DE;&#x503C;&#xFF0C;&#x4E00;&#x5B9A;&#x4F1A;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x503C;&#x3002;&#x51E1;&#x662F; JavaScript &#x8BED;&#x8A00;&#x4E2D;&#x9884;&#x671F;&#x4E3A;&#x503C;&#x7684;&#x5730;&#x65B9;&#xFF0C;&#x90FD;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x8868;&#x8FBE;&#x5F0F;&#x3002;&#x6BD4;&#x5982;&#xFF0C;&#x8D4B;&#x503C;&#x8BED;&#x53E5;&#x7684;&#x7B49;&#x53F7;&#x53F3;&#x8FB9;&#xFF0C;&#x9884;&#x671F;&#x662F;&#x4E00;&#x4E2A;&#x503C;&#xFF0C;&#x56E0;&#x6B64;&#x53EF;&#x4EE5;&#x653E;&#x7F6E;&#x5404;&#x79CD;&#x8868;&#x8FBE;&#x5F0F;&#x3002;</p>
<p>&#x8BED;&#x53E5;&#x4EE5;&#x5206;&#x53F7;&#x7ED3;&#x5C3E;&#xFF0C;&#x4E00;&#x4E2A;&#x5206;&#x53F7;&#x5C31;&#x8868;&#x793A;&#x4E00;&#x4E2A;&#x8BED;&#x53E5;&#x7ED3;&#x675F;&#x3002;&#x591A;&#x4E2A;&#x8BED;&#x53E5;&#x53EF;&#x4EE5;&#x5199;&#x5728;&#x4E00;&#x884C;&#x5185;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> a = <span class="hljs-number">1</span> + <span class="hljs-number">3</span> ; <span class="hljs-keyword">var</span> b = <span class="hljs-string">&apos;abc&apos;</span>;
</code></pre>
<p>&#x5206;&#x53F7;&#x524D;&#x9762;&#x53EF;&#x4EE5;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x5185;&#x5BB9;&#xFF0C;JavaScript &#x5F15;&#x64CE;&#x5C06;&#x5176;&#x89C6;&#x4E3A;&#x7A7A;&#x8BED;&#x53E5;&#x3002;</p>
<pre><code class="lang-javascript">;;;
</code></pre>
<p>&#x4E0A;&#x9762;&#x7684;&#x4EE3;&#x7801;&#x5C31;&#x8868;&#x793A;3&#x4E2A;&#x7A7A;&#x8BED;&#x53E5;&#x3002;</p>
<p>&#x8868;&#x8FBE;&#x5F0F;&#x4E0D;&#x9700;&#x8981;&#x5206;&#x53F7;&#x7ED3;&#x5C3E;&#x3002;&#x4E00;&#x65E6;&#x5728;&#x8868;&#x8FBE;&#x5F0F;&#x540E;&#x9762;&#x6DFB;&#x52A0;&#x5206;&#x53F7;&#xFF0C;&#x5219; JavaScript &#x5F15;&#x64CE;&#x5C31;&#x5C06;&#x8868;&#x8FBE;&#x5F0F;&#x89C6;&#x4E3A;&#x8BED;&#x53E5;&#xFF0C;&#x8FD9;&#x6837;&#x4F1A;&#x4EA7;&#x751F;&#x4E00;&#x4E9B;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x610F;&#x4E49;&#x7684;&#x8BED;&#x53E5;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-number">1</span> + <span class="hljs-number">3</span>;
<span class="hljs-string">&apos;abc&apos;</span>;
</code></pre>
<p>&#x4E0A;&#x9762;&#x4E24;&#x884C;&#x8BED;&#x53E5;&#x53EA;&#x662F;&#x5355;&#x7EAF;&#x5730;&#x4EA7;&#x751F;&#x4E00;&#x4E2A;&#x503C;&#xFF0C;&#x5E76;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x5B9E;&#x9645;&#x7684;&#x610F;&#x4E49;&#x3002;</p>
<h2 id="&#x53D8;&#x91CF;">&#x53D8;&#x91CF;</h2>
<h3 id="&#x6982;&#x5FF5;">&#x6982;&#x5FF5;</h3>
<p>&#x53D8;&#x91CF;&#x662F;&#x5BF9;&#x201C;&#x503C;&#x201D;&#x7684;&#x5177;&#x540D;&#x5F15;&#x7528;&#x3002;&#x53D8;&#x91CF;&#x5C31;&#x662F;&#x4E3A;&#x201C;&#x503C;&#x201D;&#x8D77;&#x540D;&#xFF0C;&#x7136;&#x540E;&#x5F15;&#x7528;&#x8FD9;&#x4E2A;&#x540D;&#x5B57;&#xFF0C;&#x5C31;&#x7B49;&#x540C;&#x4E8E;&#x5F15;&#x7528;&#x8FD9;&#x4E2A;&#x503C;&#x3002;&#x53D8;&#x91CF;&#x7684;&#x540D;&#x5B57;&#x5C31;&#x662F;&#x53D8;&#x91CF;&#x540D;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> a = <span class="hljs-number">1</span>;
</code></pre>
<p>&#x4E0A;&#x9762;&#x7684;&#x4EE3;&#x7801;&#x5148;&#x58F0;&#x660E;&#x53D8;&#x91CF;<code>a</code>&#xFF0C;&#x7136;&#x540E;&#x5728;&#x53D8;&#x91CF;<code>a</code>&#x4E0E;&#x6570;&#x503C;1&#x4E4B;&#x95F4;&#x5EFA;&#x7ACB;&#x5F15;&#x7528;&#x5173;&#x7CFB;&#xFF0C;&#x79F0;&#x4E3A;&#x5C06;&#x6570;&#x503C;1&#x201C;&#x8D4B;&#x503C;&#x201D;&#x7ED9;&#x53D8;&#x91CF;<code>a</code>&#x3002;&#x4EE5;&#x540E;&#xFF0C;&#x5F15;&#x7528;&#x53D8;&#x91CF;&#x540D;<code>a</code>&#x5C31;&#x4F1A;&#x5F97;&#x5230;&#x6570;&#x503C;1&#x3002;&#x6700;&#x524D;&#x9762;&#x7684;<code>var</code>&#xFF0C;&#x662F;&#x53D8;&#x91CF;&#x58F0;&#x660E;&#x547D;&#x4EE4;&#x3002;&#x5B83;&#x8868;&#x793A;&#x901A;&#x77E5;&#x89E3;&#x91CA;&#x5F15;&#x64CE;&#xFF0C;&#x8981;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;<code>a</code>&#x3002;</p>
<p>&#x6CE8;&#x610F;&#xFF0C;JavaScript &#x7684;&#x53D8;&#x91CF;&#x540D;&#x533A;&#x5206;&#x5927;&#x5C0F;&#x5199;&#xFF0C;<code>A</code>&#x548C;<code>a</code>&#x662F;&#x4E24;&#x4E2A;&#x4E0D;&#x540C;&#x7684;&#x53D8;&#x91CF;&#x3002;</p>
<p>&#x53D8;&#x91CF;&#x7684;&#x58F0;&#x660E;&#x548C;&#x8D4B;&#x503C;&#xFF0C;&#x662F;&#x5206;&#x5F00;&#x7684;&#x4E24;&#x4E2A;&#x6B65;&#x9AA4;&#xFF0C;&#x4E0A;&#x9762;&#x7684;&#x4EE3;&#x7801;&#x5C06;&#x5B83;&#x4EEC;&#x5408;&#x5728;&#x4E86;&#x4E00;&#x8D77;&#xFF0C;&#x5B9E;&#x9645;&#x7684;&#x6B65;&#x9AA4;&#x662F;&#x4E0B;&#x9762;&#x8FD9;&#x6837;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> a;
a = <span class="hljs-number">1</span>;
</code></pre>
<p>&#x5982;&#x679C;&#x53EA;&#x662F;&#x58F0;&#x660E;&#x53D8;&#x91CF;&#x800C;&#x6CA1;&#x6709;&#x8D4B;&#x503C;&#xFF0C;&#x5219;&#x8BE5;&#x53D8;&#x91CF;&#x7684;&#x503C;&#x662F;<code>undefined</code>&#x3002;<code>undefined</code>&#x662F;&#x4E00;&#x4E2A;&#x7279;&#x6B8A;&#x7684;&#x503C;&#xFF0C;&#x8868;&#x793A;&#x201C;&#x65E0;&#x5B9A;&#x4E49;&#x201D;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> a;
a <span class="hljs-comment">// undefined</span>
</code></pre>
<p>&#x5982;&#x679C;&#x53D8;&#x91CF;&#x8D4B;&#x503C;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5FD8;&#x4E86;&#x5199;<code>var</code>&#x547D;&#x4EE4;&#xFF0C;&#x8FD9;&#x6761;&#x8BED;&#x53E5;&#x4E5F;&#x662F;&#x6709;&#x6548;&#x7684;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> a = <span class="hljs-number">1</span>;
<span class="hljs-comment">// &#x57FA;&#x672C;&#x7B49;&#x540C;</span>
a = <span class="hljs-number">1</span>;
</code></pre>
<p>&#x4F46;&#x662F;&#xFF0C;&#x4E0D;&#x5199;<code>var</code>&#x7684;&#x505A;&#x6CD5;&#xFF0C;&#x4E0D;&#x5229;&#x4E8E;&#x8868;&#x8FBE;&#x610F;&#x56FE;&#xFF0C;&#x800C;&#x4E14;&#x5BB9;&#x6613;&#x4E0D;&#x77E5;&#x4E0D;&#x89C9;&#x5730;&#x521B;&#x5EFA;&#x5168;&#x5C40;&#x53D8;&#x91CF;&#xFF0C;&#x6240;&#x4EE5;&#x5EFA;&#x8BAE;&#x603B;&#x662F;&#x4F7F;&#x7528;<code>var</code>&#x547D;&#x4EE4;&#x58F0;&#x660E;&#x53D8;&#x91CF;&#x3002;</p>
<p>&#x5982;&#x679C;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x6CA1;&#x6709;&#x58F0;&#x660E;&#x5C31;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#xFF0C;JavaScript &#x4F1A;&#x62A5;&#x9519;&#xFF0C;&#x544A;&#x8BC9;&#x4F60;&#x53D8;&#x91CF;&#x672A;&#x5B9A;&#x4E49;&#x3002;</p>
<pre><code class="lang-javascript">x
<span class="hljs-comment">// ReferenceError: x is not defined</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x53D8;&#x91CF;<code>x</code>&#xFF0C;&#x7CFB;&#x7EDF;&#x5C31;&#x62A5;&#x9519;&#xFF0C;&#x544A;&#x8BC9;&#x4F60;&#x53D8;&#x91CF;<code>x</code>&#x6CA1;&#x6709;&#x58F0;&#x660E;&#x3002;</p>
<p>&#x53EF;&#x4EE5;&#x5728;&#x540C;&#x4E00;&#x6761;<code>var</code>&#x547D;&#x4EE4;&#x4E2D;&#x58F0;&#x660E;&#x591A;&#x4E2A;&#x53D8;&#x91CF;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> a, b;
</code></pre>
<p>JavaScript &#x662F;&#x4E00;&#x79CD;&#x52A8;&#x6001;&#x7C7B;&#x578B;&#x8BED;&#x8A00;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#xFF0C;&#x53D8;&#x91CF;&#x7684;&#x7C7B;&#x578B;&#x6CA1;&#x6709;&#x9650;&#x5236;&#xFF0C;&#x53D8;&#x91CF;&#x53EF;&#x4EE5;&#x968F;&#x65F6;&#x66F4;&#x6539;&#x7C7B;&#x578B;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> a = <span class="hljs-number">1</span>;
a = <span class="hljs-string">&apos;hello&apos;</span>;
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;&#x53D8;&#x91CF;<code>a</code>&#x8D77;&#x5148;&#x88AB;&#x8D4B;&#x503C;&#x4E3A;&#x4E00;&#x4E2A;&#x6570;&#x503C;&#xFF0C;&#x540E;&#x6765;&#x53C8;&#x88AB;&#x91CD;&#x65B0;&#x8D4B;&#x503C;&#x4E3A;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x3002;&#x7B2C;&#x4E8C;&#x6B21;&#x8D4B;&#x503C;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x56E0;&#x4E3A;&#x53D8;&#x91CF;<code>a</code>&#x5DF2;&#x7ECF;&#x5B58;&#x5728;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x9700;&#x8981;&#x4F7F;&#x7528;<code>var</code>&#x547D;&#x4EE4;&#x3002;</p>
<p>&#x5982;&#x679C;&#x4F7F;&#x7528;<code>var</code>&#x91CD;&#x65B0;&#x58F0;&#x660E;&#x4E00;&#x4E2A;&#x5DF2;&#x7ECF;&#x5B58;&#x5728;&#x7684;&#x53D8;&#x91CF;&#xFF0C;&#x662F;&#x65E0;&#x6548;&#x7684;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> x = <span class="hljs-number">1</span>;
<span class="hljs-keyword">var</span> x;
x <span class="hljs-comment">// 1</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;&#x53D8;&#x91CF;<code>x</code>&#x58F0;&#x660E;&#x4E86;&#x4E24;&#x6B21;&#xFF0C;&#x7B2C;&#x4E8C;&#x6B21;&#x58F0;&#x660E;&#x662F;&#x65E0;&#x6548;&#x7684;&#x3002;</p>
<p>&#x4F46;&#x662F;&#xFF0C;&#x5982;&#x679C;&#x7B2C;&#x4E8C;&#x6B21;&#x58F0;&#x660E;&#x7684;&#x65F6;&#x5019;&#x8FD8;&#x8FDB;&#x884C;&#x4E86;&#x8D4B;&#x503C;&#xFF0C;&#x5219;&#x4F1A;&#x8986;&#x76D6;&#x6389;&#x524D;&#x9762;&#x7684;&#x503C;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> x = <span class="hljs-number">1</span>;
<span class="hljs-keyword">var</span> x = <span class="hljs-number">2</span>;

<span class="hljs-comment">// &#x7B49;&#x540C;&#x4E8E;</span>

<span class="hljs-keyword">var</span> x = <span class="hljs-number">1</span>;
<span class="hljs-keyword">var</span> x;
x = <span class="hljs-number">2</span>;
</code></pre>
<h3 id="&#x53D8;&#x91CF;&#x63D0;&#x5347;">&#x53D8;&#x91CF;&#x63D0;&#x5347;</h3>
<p>JavaScript &#x5F15;&#x64CE;&#x7684;&#x5DE5;&#x4F5C;&#x65B9;&#x5F0F;&#x662F;&#xFF0C;&#x5148;&#x89E3;&#x6790;&#x4EE3;&#x7801;&#xFF0C;&#x83B7;&#x53D6;&#x6240;&#x6709;&#x88AB;&#x58F0;&#x660E;&#x7684;&#x53D8;&#x91CF;&#xFF0C;&#x7136;&#x540E;&#x518D;&#x4E00;&#x884C;&#x4E00;&#x884C;&#x5730;&#x8FD0;&#x884C;&#x3002;&#x8FD9;&#x9020;&#x6210;&#x7684;&#x7ED3;&#x679C;&#xFF0C;&#x5C31;&#x662F;&#x6240;&#x6709;&#x7684;&#x53D8;&#x91CF;&#x7684;&#x58F0;&#x660E;&#x8BED;&#x53E5;&#xFF0C;&#x90FD;&#x4F1A;&#x88AB;&#x63D0;&#x5347;&#x5230;&#x4EE3;&#x7801;&#x7684;&#x5934;&#x90E8;&#xFF0C;&#x8FD9;&#x5C31;&#x53EB;&#x505A;&#x53D8;&#x91CF;&#x63D0;&#x5347;&#xFF08;hoisting&#xFF09;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.log(a);
<span class="hljs-keyword">var</span> a = <span class="hljs-number">1</span>;
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x9996;&#x5148;&#x4F7F;&#x7528;<code>console.log</code>&#x65B9;&#x6CD5;&#xFF0C;&#x5728;&#x63A7;&#x5236;&#x53F0;&#xFF08;console&#xFF09;&#x663E;&#x793A;&#x53D8;&#x91CF;<code>a</code>&#x7684;&#x503C;&#x3002;&#x8FD9;&#x65F6;&#x53D8;&#x91CF;<code>a</code>&#x8FD8;&#x6CA1;&#x6709;&#x58F0;&#x660E;&#x548C;&#x8D4B;&#x503C;&#xFF0C;&#x6240;&#x4EE5;&#x8FD9;&#x662F;&#x4E00;&#x79CD;&#x9519;&#x8BEF;&#x7684;&#x505A;&#x6CD5;&#xFF0C;&#x4F46;&#x662F;&#x5B9E;&#x9645;&#x4E0A;&#x4E0D;&#x4F1A;&#x62A5;&#x9519;&#x3002;&#x56E0;&#x4E3A;&#x5B58;&#x5728;&#x53D8;&#x91CF;&#x63D0;&#x5347;&#xFF0C;&#x771F;&#x6B63;&#x8FD0;&#x884C;&#x7684;&#x662F;&#x4E0B;&#x9762;&#x7684;&#x4EE3;&#x7801;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> a;
<span class="hljs-built_in">console</span>.log(a);
a = <span class="hljs-number">1</span>;
</code></pre>
<p>&#x6700;&#x540E;&#x7684;&#x7ED3;&#x679C;&#x662F;&#x663E;&#x793A;<code>undefined</code>&#xFF0C;&#x8868;&#x793A;&#x53D8;&#x91CF;<code>a</code>&#x5DF2;&#x58F0;&#x660E;&#xFF0C;&#x4F46;&#x8FD8;&#x672A;&#x8D4B;&#x503C;&#x3002;</p>
<h2 id="&#x6807;&#x8BC6;&#x7B26;">&#x6807;&#x8BC6;&#x7B26;</h2>
<p>&#x6807;&#x8BC6;&#x7B26;&#xFF08;identifier&#xFF09;&#x6307;&#x7684;&#x662F;&#x7528;&#x6765;&#x8BC6;&#x522B;&#x5404;&#x79CD;&#x503C;&#x7684;&#x5408;&#x6CD5;&#x540D;&#x79F0;&#x3002;&#x6700;&#x5E38;&#x89C1;&#x7684;&#x6807;&#x8BC6;&#x7B26;&#x5C31;&#x662F;&#x53D8;&#x91CF;&#x540D;&#xFF0C;&#x4EE5;&#x53CA;&#x540E;&#x9762;&#x8981;&#x63D0;&#x5230;&#x7684;&#x51FD;&#x6570;&#x540D;&#x3002;JavaScript &#x8BED;&#x8A00;&#x7684;&#x6807;&#x8BC6;&#x7B26;&#x5BF9;&#x5927;&#x5C0F;&#x5199;&#x654F;&#x611F;&#xFF0C;&#x6240;&#x4EE5;<code>a</code>&#x548C;<code>A</code>&#x662F;&#x4E24;&#x4E2A;&#x4E0D;&#x540C;&#x7684;&#x6807;&#x8BC6;&#x7B26;&#x3002;</p>
<p>&#x6807;&#x8BC6;&#x7B26;&#x6709;&#x4E00;&#x5957;&#x547D;&#x540D;&#x89C4;&#x5219;&#xFF0C;&#x4E0D;&#x7B26;&#x5408;&#x89C4;&#x5219;&#x7684;&#x5C31;&#x662F;&#x975E;&#x6CD5;&#x6807;&#x8BC6;&#x7B26;&#x3002;JavaScript &#x5F15;&#x64CE;&#x9047;&#x5230;&#x975E;&#x6CD5;&#x6807;&#x8BC6;&#x7B26;&#xFF0C;&#x5C31;&#x4F1A;&#x62A5;&#x9519;&#x3002;</p>
<p>&#x7B80;&#x5355;&#x8BF4;&#xFF0C;&#x6807;&#x8BC6;&#x7B26;&#x547D;&#x540D;&#x89C4;&#x5219;&#x5982;&#x4E0B;&#x3002;</p>
<ul>
<li>&#x7B2C;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#xFF0C;&#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x610F; Unicode &#x5B57;&#x6BCD;&#xFF08;&#x5305;&#x62EC;&#x82F1;&#x6587;&#x5B57;&#x6BCD;&#x548C;&#x5176;&#x4ED6;&#x8BED;&#x8A00;&#x7684;&#x5B57;&#x6BCD;&#xFF09;&#xFF0C;&#x4EE5;&#x53CA;&#x7F8E;&#x5143;&#x7B26;&#x53F7;&#xFF08;<code>$</code>&#xFF09;&#x548C;&#x4E0B;&#x5212;&#x7EBF;&#xFF08;<code>_</code>&#xFF09;&#x3002;</li>
<li>&#x7B2C;&#x4E8C;&#x4E2A;&#x5B57;&#x7B26;&#x53CA;&#x540E;&#x9762;&#x7684;&#x5B57;&#x7B26;&#xFF0C;&#x9664;&#x4E86; Unicode &#x5B57;&#x6BCD;&#x3001;&#x7F8E;&#x5143;&#x7B26;&#x53F7;&#x548C;&#x4E0B;&#x5212;&#x7EBF;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x7528;&#x6570;&#x5B57;<code>0-9</code>&#x3002;</li>
</ul>
<p>&#x4E0B;&#x9762;&#x8FD9;&#x4E9B;&#x90FD;&#x662F;&#x5408;&#x6CD5;&#x7684;&#x6807;&#x8BC6;&#x7B26;&#x3002;</p>
<pre><code class="lang-javascript">arg0
_tmp
$elem
&#x3C0;
</code></pre>
<p>&#x4E0B;&#x9762;&#x8FD9;&#x4E9B;&#x5219;&#x662F;&#x4E0D;&#x5408;&#x6CD5;&#x7684;&#x6807;&#x8BC6;&#x7B26;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-number">1</span>a  <span class="hljs-comment">// &#x7B2C;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E0D;&#x80FD;&#x662F;&#x6570;&#x5B57;</span>
<span class="hljs-number">23</span>  <span class="hljs-comment">// &#x540C;&#x4E0A;</span>
***  <span class="hljs-comment">// &#x6807;&#x8BC6;&#x7B26;&#x4E0D;&#x80FD;&#x5305;&#x542B;&#x661F;&#x53F7;</span>
a+b  <span class="hljs-comment">// &#x6807;&#x8BC6;&#x7B26;&#x4E0D;&#x80FD;&#x5305;&#x542B;&#x52A0;&#x53F7;</span>
-d  <span class="hljs-comment">// &#x6807;&#x8BC6;&#x7B26;&#x4E0D;&#x80FD;&#x5305;&#x542B;&#x51CF;&#x53F7;&#x6216;&#x8FDE;&#x8BCD;&#x7EBF;</span>
</code></pre>
<p>&#x4E2D;&#x6587;&#x662F;&#x5408;&#x6CD5;&#x7684;&#x6807;&#x8BC6;&#x7B26;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;&#x4F5C;&#x53D8;&#x91CF;&#x540D;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> &#x4E34;&#x65F6;&#x53D8;&#x91CF; = <span class="hljs-number">1</span>;
</code></pre>
<blockquote>
<p>JavaScript &#x6709;&#x4E00;&#x4E9B;&#x4FDD;&#x7559;&#x5B57;&#xFF0C;&#x4E0D;&#x80FD;&#x7528;&#x4F5C;&#x6807;&#x8BC6;&#x7B26;&#xFF1A;arguments&#x3001;break&#x3001;case&#x3001;catch&#x3001;class&#x3001;const&#x3001;continue&#x3001;debugger&#x3001;default&#x3001;delete&#x3001;do&#x3001;else&#x3001;enum&#x3001;eval&#x3001;export&#x3001;extends&#x3001;false&#x3001;finally&#x3001;for&#x3001;function&#x3001;if&#x3001;implements&#x3001;import&#x3001;in&#x3001;instanceof&#x3001;interface&#x3001;let&#x3001;new&#x3001;null&#x3001;package&#x3001;private&#x3001;protected&#x3001;public&#x3001;return&#x3001;static&#x3001;super&#x3001;switch&#x3001;this&#x3001;throw&#x3001;true&#x3001;try&#x3001;typeof&#x3001;var&#x3001;void&#x3001;while&#x3001;with&#x3001;yield&#x3002;</p>
</blockquote>
<h2 id="&#x6CE8;&#x91CA;">&#x6CE8;&#x91CA;</h2>
<p>&#x6E90;&#x7801;&#x4E2D;&#x88AB; JavaScript &#x5F15;&#x64CE;&#x5FFD;&#x7565;&#x7684;&#x90E8;&#x5206;&#x5C31;&#x53EB;&#x505A;&#x6CE8;&#x91CA;&#xFF0C;&#x5B83;&#x7684;&#x4F5C;&#x7528;&#x662F;&#x5BF9;&#x4EE3;&#x7801;&#x8FDB;&#x884C;&#x89E3;&#x91CA;&#x3002;JavaScript &#x63D0;&#x4F9B;&#x4E24;&#x79CD;&#x6CE8;&#x91CA;&#x7684;&#x5199;&#x6CD5;&#xFF1A;&#x4E00;&#x79CD;&#x662F;&#x5355;&#x884C;&#x6CE8;&#x91CA;&#xFF0C;&#x7528;<code>//</code>&#x8D77;&#x5934;&#xFF1B;&#x53E6;&#x4E00;&#x79CD;&#x662F;&#x591A;&#x884C;&#x6CE8;&#x91CA;&#xFF0C;&#x653E;&#x5728;<code>/*</code>&#x548C;<code>*/</code>&#x4E4B;&#x95F4;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x8FD9;&#x662F;&#x5355;&#x884C;&#x6CE8;&#x91CA;</span>

<span class="hljs-comment">/*
 &#x8FD9;&#x662F;
 &#x591A;&#x884C;
 &#x6CE8;&#x91CA;
*/</span>
</code></pre>
<p>&#x6B64;&#x5916;&#xFF0C;&#x7531;&#x4E8E;&#x5386;&#x53F2;&#x4E0A; JavaScript &#x53EF;&#x4EE5;&#x517C;&#x5BB9; HTML &#x4EE3;&#x7801;&#x7684;&#x6CE8;&#x91CA;&#xFF0C;&#x6240;&#x4EE5;<code>&lt;!--</code>&#x548C;<code>--&gt;</code>&#x4E5F;&#x88AB;&#x89C6;&#x4E3A;&#x5408;&#x6CD5;&#x7684;&#x5355;&#x884C;&#x6CE8;&#x91CA;&#x3002;</p>
<pre><code class="lang-javascript">x = <span class="hljs-number">1</span>; <span class="xml"><span class="hljs-comment">&lt;!-- x = 2;
--&gt;</span> x = 3;
</span></code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;&#x53EA;&#x6709;<code>x = 1</code>&#x4F1A;&#x6267;&#x884C;&#xFF0C;&#x5176;&#x4ED6;&#x7684;&#x90E8;&#x5206;&#x90FD;&#x88AB;&#x6CE8;&#x91CA;&#x6389;&#x4E86;&#x3002;</p>
<p>&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;<code>--&gt;</code>&#x53EA;&#x6709;&#x5728;&#x884C;&#x9996;&#xFF0C;&#x624D;&#x4F1A;&#x88AB;&#x5F53;&#x6210;&#x5355;&#x884C;&#x6CE8;&#x91CA;&#xFF0C;&#x5426;&#x5219;&#x4F1A;&#x5F53;&#x4F5C;&#x6B63;&#x5E38;&#x7684;&#x8FD0;&#x7B97;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">countdown</span>(<span class="hljs-params">n</span>) </span>{
  <span class="hljs-keyword">while</span> (n --&gt; <span class="hljs-number">0</span>) <span class="hljs-built_in">console</span>.log(n);
}
countdown(<span class="hljs-number">3</span>)
<span class="hljs-comment">// 2</span>
<span class="hljs-comment">// 1</span>
<span class="hljs-comment">// 0</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;<code>n --&gt; 0</code>&#x5B9E;&#x9645;&#x4E0A;&#x4F1A;&#x5F53;&#x4F5C;<code>n-- &gt; 0</code>&#xFF0C;&#x56E0;&#x6B64;&#x8F93;&#x51FA;2&#x3001;1&#x3001;0&#x3002;</p>
<h2 id="&#x533A;&#x5757;">&#x533A;&#x5757;</h2>
<p>JavaScript &#x4F7F;&#x7528;&#x5927;&#x62EC;&#x53F7;&#xFF0C;&#x5C06;&#x591A;&#x4E2A;&#x76F8;&#x5173;&#x7684;&#x8BED;&#x53E5;&#x7EC4;&#x5408;&#x5728;&#x4E00;&#x8D77;&#xFF0C;&#x79F0;&#x4E3A;&#x201C;&#x533A;&#x5757;&#x201D;&#xFF08;block&#xFF09;&#x3002;</p>
<p>&#x5BF9;&#x4E8E;<code>var</code>&#x547D;&#x4EE4;&#x6765;&#x8BF4;&#xFF0C;JavaScript &#x7684;&#x533A;&#x5757;&#x4E0D;&#x6784;&#x6210;&#x5355;&#x72EC;&#x7684;&#x4F5C;&#x7528;&#x57DF;&#xFF08;scope&#xFF09;&#x3002;</p>
<pre><code class="lang-javascript">{
  <span class="hljs-keyword">var</span> a = <span class="hljs-number">1</span>;
}

a <span class="hljs-comment">// 1</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x5728;&#x533A;&#x5757;&#x5185;&#x90E8;&#xFF0C;&#x4F7F;&#x7528;<code>var</code>&#x547D;&#x4EE4;&#x58F0;&#x660E;&#x5E76;&#x8D4B;&#x503C;&#x4E86;&#x53D8;&#x91CF;<code>a</code>&#xFF0C;&#x7136;&#x540E;&#x5728;&#x533A;&#x5757;&#x5916;&#x90E8;&#xFF0C;&#x53D8;&#x91CF;<code>a</code>&#x4F9D;&#x7136;&#x6709;&#x6548;&#xFF0C;&#x533A;&#x5757;&#x5BF9;&#x4E8E;<code>var</code>&#x547D;&#x4EE4;&#x4E0D;&#x6784;&#x6210;&#x5355;&#x72EC;&#x7684;&#x4F5C;&#x7528;&#x57DF;&#xFF0C;&#x4E0E;&#x4E0D;&#x4F7F;&#x7528;&#x533A;&#x5757;&#x7684;&#x60C5;&#x51B5;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x533A;&#x522B;&#x3002;&#x5728; JavaScript &#x8BED;&#x8A00;&#x4E2D;&#xFF0C;&#x5355;&#x72EC;&#x4F7F;&#x7528;&#x533A;&#x5757;&#x5E76;&#x4E0D;&#x5E38;&#x89C1;&#xFF0C;&#x533A;&#x5757;&#x5F80;&#x5F80;&#x7528;&#x6765;&#x6784;&#x6210;&#x5176;&#x4ED6;&#x66F4;&#x590D;&#x6742;&#x7684;&#x8BED;&#x6CD5;&#x7ED3;&#x6784;&#xFF0C;&#x6BD4;&#x5982;<code>for</code>&#x3001;<code>if</code>&#x3001;<code>while</code>&#x3001;<code>function</code>&#x7B49;&#x3002;</p>
<h2 id="&#x6761;&#x4EF6;&#x8BED;&#x53E5;">&#x6761;&#x4EF6;&#x8BED;&#x53E5;</h2>
<p>JavaScript &#x63D0;&#x4F9B;<code>if</code>&#x7ED3;&#x6784;&#x548C;<code>switch</code>&#x7ED3;&#x6784;&#xFF0C;&#x5B8C;&#x6210;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#xFF0C;&#x5373;&#x53EA;&#x6709;&#x6EE1;&#x8DB3;&#x9884;&#x8BBE;&#x7684;&#x6761;&#x4EF6;&#xFF0C;&#x624D;&#x4F1A;&#x6267;&#x884C;&#x76F8;&#x5E94;&#x7684;&#x8BED;&#x53E5;&#x3002;</p>
<h3 id="if-&#x7ED3;&#x6784;">if &#x7ED3;&#x6784;</h3>
<p><code>if</code>&#x7ED3;&#x6784;&#x5148;&#x5224;&#x65AD;&#x4E00;&#x4E2A;&#x8868;&#x8FBE;&#x5F0F;&#x7684;&#x5E03;&#x5C14;&#x503C;&#xFF0C;&#x7136;&#x540E;&#x6839;&#x636E;&#x5E03;&#x5C14;&#x503C;&#x7684;&#x771F;&#x4F2A;&#xFF0C;&#x6267;&#x884C;&#x4E0D;&#x540C;&#x7684;&#x8BED;&#x53E5;&#x3002;&#x6240;&#x8C13;&#x5E03;&#x5C14;&#x503C;&#xFF0C;&#x6307;&#x7684;&#x662F; JavaScript &#x7684;&#x4E24;&#x4E2A;&#x7279;&#x6B8A;&#x503C;&#xFF0C;<code>true</code>&#x8868;&#x793A;&#x771F;&#xFF0C;<code>false</code>&#x8868;&#x793A;<code>&#x4F2A;</code>&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">if</span> (&#x5E03;&#x5C14;&#x503C;)
  &#x8BED;&#x53E5;;

<span class="hljs-comment">// &#x6216;&#x8005;</span>
<span class="hljs-keyword">if</span> (&#x5E03;&#x5C14;&#x503C;) &#x8BED;&#x53E5;;
</code></pre>
<p>&#x4E0A;&#x9762;&#x662F;<code>if</code>&#x7ED3;&#x6784;&#x7684;&#x57FA;&#x672C;&#x5F62;&#x5F0F;&#x3002;&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;&#x201C;&#x5E03;&#x5C14;&#x503C;&#x201D;&#x5F80;&#x5F80;&#x7531;&#x4E00;&#x4E2A;&#x6761;&#x4EF6;&#x8868;&#x8FBE;&#x5F0F;&#x4EA7;&#x751F;&#x7684;&#xFF0C;&#x5FC5;&#x987B;&#x653E;&#x5728;&#x5706;&#x62EC;&#x53F7;&#x4E2D;&#xFF0C;&#x8868;&#x793A;&#x5BF9;&#x8868;&#x8FBE;&#x5F0F;&#x6C42;&#x503C;&#x3002;&#x5982;&#x679C;&#x8868;&#x8FBE;&#x5F0F;&#x7684;&#x6C42;&#x503C;&#x7ED3;&#x679C;&#x4E3A;<code>true</code>&#xFF0C;&#x5C31;&#x6267;&#x884C;&#x7D27;&#x8DDF;&#x5728;&#x540E;&#x9762;&#x7684;&#x8BED;&#x53E5;&#xFF1B;&#x5982;&#x679C;&#x7ED3;&#x679C;&#x4E3A;<code>false</code>&#xFF0C;&#x5219;&#x8DF3;&#x8FC7;&#x7D27;&#x8DDF;&#x5728;&#x540E;&#x9762;&#x7684;&#x8BED;&#x53E5;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">if</span> (m === <span class="hljs-number">3</span>)
  m = m + <span class="hljs-number">1</span>;
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x8868;&#x793A;&#xFF0C;&#x53EA;&#x6709;&#x5728;<code>m</code>&#x7B49;&#x4E8E;3&#x65F6;&#xFF0C;&#x624D;&#x4F1A;&#x5C06;&#x5176;&#x503C;&#x52A0;&#x4E0A;1&#x3002;</p>
<p>&#x8FD9;&#x79CD;&#x5199;&#x6CD5;&#x8981;&#x6C42;&#x6761;&#x4EF6;&#x8868;&#x8FBE;&#x5F0F;&#x540E;&#x9762;&#x53EA;&#x80FD;&#x6709;&#x4E00;&#x4E2A;&#x8BED;&#x53E5;&#x3002;&#x5982;&#x679C;&#x60F3;&#x6267;&#x884C;&#x591A;&#x4E2A;&#x8BED;&#x53E5;&#xFF0C;&#x5FC5;&#x987B;&#x5728;<code>if</code>&#x7684;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x4E4B;&#x540E;&#xFF0C;&#x52A0;&#x4E0A;&#x5927;&#x62EC;&#x53F7;&#xFF0C;&#x8868;&#x793A;&#x4EE3;&#x7801;&#x5757;&#xFF08;&#x591A;&#x4E2A;&#x8BED;&#x53E5;&#x5408;&#x5E76;&#x6210;&#x4E00;&#x4E2A;&#x8BED;&#x53E5;&#xFF09;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">if</span> (m === <span class="hljs-number">3</span>) {
  m += <span class="hljs-number">1</span>;
}
</code></pre>
<p>&#x5EFA;&#x8BAE;&#x603B;&#x662F;&#x5728;<code>if</code>&#x8BED;&#x53E5;&#x4E2D;&#x4F7F;&#x7528;&#x5927;&#x62EC;&#x53F7;&#xFF0C;&#x56E0;&#x4E3A;&#x8FD9;&#x6837;&#x65B9;&#x4FBF;&#x63D2;&#x5165;&#x8BED;&#x53E5;&#x3002;</p>
<p>&#x6CE8;&#x610F;&#xFF0C;<code>if</code>&#x540E;&#x9762;&#x7684;&#x8868;&#x8FBE;&#x5F0F;&#x4E4B;&#x4E2D;&#xFF0C;&#x4E0D;&#x8981;&#x6DF7;&#x6DC6;&#x8D4B;&#x503C;&#x8868;&#x8FBE;&#x5F0F;&#xFF08;<code>=</code>&#xFF09;&#x3001;&#x4E25;&#x683C;&#x76F8;&#x7B49;&#x8FD0;&#x7B97;&#x7B26;&#xFF08;<code>===</code>&#xFF09;&#x548C;&#x76F8;&#x7B49;&#x8FD0;&#x7B97;&#x7B26;&#xFF08;<code>==</code>&#xFF09;&#x3002;&#x5C24;&#x5176;&#x662F;&#x8D4B;&#x503C;&#x8868;&#x8FBE;&#x5F0F;&#x4E0D;&#x5177;&#x6709;&#x6BD4;&#x8F83;&#x4F5C;&#x7528;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> x = <span class="hljs-number">1</span>;
<span class="hljs-keyword">var</span> y = <span class="hljs-number">2</span>;
<span class="hljs-keyword">if</span> (x = y) {
  <span class="hljs-built_in">console</span>.log(x);
}
<span class="hljs-comment">// &quot;2&quot;</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x7684;&#x539F;&#x610F;&#x662F;&#xFF0C;&#x5F53;<code>x</code>&#x7B49;&#x4E8E;<code>y</code>&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x624D;&#x6267;&#x884C;&#x76F8;&#x5173;&#x8BED;&#x53E5;&#x3002;&#x4F46;&#x662F;&#xFF0C;&#x4E0D;&#x5C0F;&#x5FC3;&#x5C06;&#x4E25;&#x683C;&#x76F8;&#x7B49;&#x8FD0;&#x7B97;&#x7B26;&#x5199;&#x6210;&#x8D4B;&#x503C;&#x8868;&#x8FBE;&#x5F0F;&#xFF0C;&#x7ED3;&#x679C;&#x53D8;&#x6210;&#x4E86;&#x5C06;<code>y</code>&#x8D4B;&#x503C;&#x7ED9;&#x53D8;&#x91CF;<code>x</code>&#xFF0C;&#x518D;&#x5224;&#x65AD;&#x53D8;&#x91CF;<code>x</code>&#x7684;&#x503C;&#xFF08;&#x7B49;&#x4E8E;2&#xFF09;&#x7684;&#x5E03;&#x5C14;&#x503C;&#xFF08;&#x7ED3;&#x679C;&#x4E3A;<code>true</code>&#xFF09;&#x3002;</p>
<p>&#x8FD9;&#x79CD;&#x9519;&#x8BEF;&#x53EF;&#x4EE5;&#x6B63;&#x5E38;&#x751F;&#x6210;&#x4E00;&#x4E2A;&#x5E03;&#x5C14;&#x503C;&#xFF0C;&#x56E0;&#x800C;&#x4E0D;&#x4F1A;&#x62A5;&#x9519;&#x3002;&#x4E3A;&#x4E86;&#x907F;&#x514D;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#xFF0C;&#x6709;&#x4E9B;&#x5F00;&#x53D1;&#x8005;&#x4E60;&#x60EF;&#x5C06;&#x5E38;&#x91CF;&#x5199;&#x5728;&#x8FD0;&#x7B97;&#x7B26;&#x7684;&#x5DE6;&#x8FB9;&#xFF0C;&#x8FD9;&#x6837;&#x7684;&#x8BDD;&#xFF0C;&#x4E00;&#x65E6;&#x4E0D;&#x5C0F;&#x5FC3;&#x5C06;&#x76F8;&#x7B49;&#x8FD0;&#x7B97;&#x7B26;&#x5199;&#x6210;&#x8D4B;&#x503C;&#x8FD0;&#x7B97;&#x7B26;&#xFF0C;&#x5C31;&#x4F1A;&#x62A5;&#x9519;&#xFF0C;&#x56E0;&#x4E3A;&#x5E38;&#x91CF;&#x4E0D;&#x80FD;&#x88AB;&#x8D4B;&#x503C;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">if</span> (x = <span class="hljs-number">2</span>) { <span class="hljs-comment">// &#x4E0D;&#x62A5;&#x9519;</span>
<span class="hljs-keyword">if</span> (<span class="hljs-number">2</span> = x) { <span class="hljs-comment">// &#x62A5;&#x9519;</span>
</code></pre>
<p>&#x81F3;&#x4E8E;&#x4E3A;&#x4EC0;&#x4E48;&#x4F18;&#x5148;&#x91C7;&#x7528;&#x201C;&#x4E25;&#x683C;&#x76F8;&#x7B49;&#x8FD0;&#x7B97;&#x7B26;&#x201D;&#xFF08;<code>===</code>&#xFF09;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x201C;&#x76F8;&#x7B49;&#x8FD0;&#x7B97;&#x7B26;&#x201D;&#xFF08;<code>==</code>&#xFF09;&#xFF0C;&#x8BF7;&#x53C2;&#x8003;&#x300A;&#x8FD0;&#x7B97;&#x7B26;&#x300B;&#x7AE0;&#x8282;&#x3002;</p>
<h3 id="ifelse-&#x7ED3;&#x6784;">if...else &#x7ED3;&#x6784;</h3>
<p><code>if</code>&#x4EE3;&#x7801;&#x5757;&#x540E;&#x9762;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x8DDF;&#x4E00;&#x4E2A;<code>else</code>&#x4EE3;&#x7801;&#x5757;&#xFF0C;&#x8868;&#x793A;&#x4E0D;&#x6EE1;&#x8DB3;&#x6761;&#x4EF6;&#x65F6;&#xFF0C;&#x6240;&#x8981;&#x6267;&#x884C;&#x7684;&#x4EE3;&#x7801;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">if</span> (m === <span class="hljs-number">3</span>) {
  <span class="hljs-comment">// &#x6EE1;&#x8DB3;&#x6761;&#x4EF6;&#x65F6;&#xFF0C;&#x6267;&#x884C;&#x7684;&#x8BED;&#x53E5;</span>
} <span class="hljs-keyword">else</span> {
  <span class="hljs-comment">// &#x4E0D;&#x6EE1;&#x8DB3;&#x6761;&#x4EF6;&#x65F6;&#xFF0C;&#x6267;&#x884C;&#x7684;&#x8BED;&#x53E5;</span>
}
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x5224;&#x65AD;&#x53D8;&#x91CF;<code>m</code>&#x662F;&#x5426;&#x7B49;&#x4E8E;3&#xFF0C;&#x5982;&#x679C;&#x7B49;&#x4E8E;&#x5C31;&#x6267;&#x884C;<code>if</code>&#x4EE3;&#x7801;&#x5757;&#xFF0C;&#x5426;&#x5219;&#x6267;&#x884C;<code>else</code>&#x4EE3;&#x7801;&#x5757;&#x3002;</p>
<p>&#x5BF9;&#x540C;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x8FDB;&#x884C;&#x591A;&#x6B21;&#x5224;&#x65AD;&#x65F6;&#xFF0C;&#x591A;&#x4E2A;<code>if...else</code>&#x8BED;&#x53E5;&#x53EF;&#x4EE5;&#x8FDE;&#x5199;&#x5728;&#x4E00;&#x8D77;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">if</span> (m === <span class="hljs-number">0</span>) {
  <span class="hljs-comment">// ...</span>
} <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (m === <span class="hljs-number">1</span>) {
  <span class="hljs-comment">// ...</span>
} <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (m === <span class="hljs-number">2</span>) {
  <span class="hljs-comment">// ...</span>
} <span class="hljs-keyword">else</span> {
  <span class="hljs-comment">// ...</span>
}
</code></pre>
<p><code>else</code>&#x4EE3;&#x7801;&#x5757;&#x603B;&#x662F;&#x4E0E;&#x79BB;&#x81EA;&#x5DF1;&#x6700;&#x8FD1;&#x7684;&#x90A3;&#x4E2A;<code>if</code>&#x8BED;&#x53E5;&#x914D;&#x5BF9;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> m = <span class="hljs-number">1</span>;
<span class="hljs-keyword">var</span> n = <span class="hljs-number">2</span>;

<span class="hljs-keyword">if</span> (m !== <span class="hljs-number">1</span>)
<span class="hljs-keyword">if</span> (n === <span class="hljs-number">2</span>) <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;hello&apos;</span>);
<span class="hljs-keyword">else</span> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;world&apos;</span>);
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E0D;&#x4F1A;&#x6709;&#x4EFB;&#x4F55;&#x8F93;&#x51FA;&#xFF0C;<code>else</code>&#x4EE3;&#x7801;&#x5757;&#x4E0D;&#x4F1A;&#x5F97;&#x5230;&#x6267;&#x884C;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x8DDF;&#x7740;&#x7684;&#x662F;&#x6700;&#x8FD1;&#x7684;&#x90A3;&#x4E2A;<code>if</code>&#x8BED;&#x53E5;&#xFF0C;&#x76F8;&#x5F53;&#x4E8E;&#x4E0B;&#x9762;&#x8FD9;&#x6837;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">if</span> (m !== <span class="hljs-number">1</span>) {
  <span class="hljs-keyword">if</span> (n === <span class="hljs-number">2</span>) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;hello&apos;</span>);
  } <span class="hljs-keyword">else</span> {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;world&apos;</span>);
  }
}
</code></pre>
<p>&#x5982;&#x679C;&#x60F3;&#x8BA9;<code>else</code>&#x4EE3;&#x7801;&#x5757;&#x8DDF;&#x968F;&#x6700;&#x4E0A;&#x9762;&#x7684;&#x90A3;&#x4E2A;<code>if</code>&#x8BED;&#x53E5;&#xFF0C;&#x5C31;&#x8981;&#x6539;&#x53D8;&#x5927;&#x62EC;&#x53F7;&#x7684;&#x4F4D;&#x7F6E;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">if</span> (m !== <span class="hljs-number">1</span>) {
  <span class="hljs-keyword">if</span> (n === <span class="hljs-number">2</span>) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;hello&apos;</span>);
  }
} <span class="hljs-keyword">else</span> {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;world&apos;</span>);
}
<span class="hljs-comment">// world</span>
</code></pre>
<h3 id="switch-&#x7ED3;&#x6784;">switch &#x7ED3;&#x6784;</h3>
<p>&#x591A;&#x4E2A;<code>if...else</code>&#x8FDE;&#x5728;&#x4E00;&#x8D77;&#x4F7F;&#x7528;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x53EF;&#x4EE5;&#x8F6C;&#x4E3A;&#x4F7F;&#x7528;&#x66F4;&#x65B9;&#x4FBF;&#x7684;<code>switch</code>&#x7ED3;&#x6784;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">switch</span> (fruit) {
  <span class="hljs-keyword">case</span> <span class="hljs-string">&quot;banana&quot;</span>:
    <span class="hljs-comment">// ...</span>
    <span class="hljs-keyword">break</span>;
  <span class="hljs-keyword">case</span> <span class="hljs-string">&quot;apple&quot;</span>:
    <span class="hljs-comment">// ...</span>
    <span class="hljs-keyword">break</span>;
  <span class="hljs-keyword">default</span>:
    <span class="hljs-comment">// ...</span>
}
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x6839;&#x636E;&#x53D8;&#x91CF;<code>fruit</code>&#x7684;&#x503C;&#xFF0C;&#x9009;&#x62E9;&#x6267;&#x884C;&#x76F8;&#x5E94;&#x7684;<code>case</code>&#x3002;&#x5982;&#x679C;&#x6240;&#x6709;<code>case</code>&#x90FD;&#x4E0D;&#x7B26;&#x5408;&#xFF0C;&#x5219;&#x6267;&#x884C;&#x6700;&#x540E;&#x7684;<code>default</code>&#x90E8;&#x5206;&#x3002;&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;&#x6BCF;&#x4E2A;<code>case</code>&#x4EE3;&#x7801;&#x5757;&#x5185;&#x90E8;&#x7684;<code>break</code>&#x8BED;&#x53E5;&#x4E0D;&#x80FD;&#x5C11;&#xFF0C;&#x5426;&#x5219;&#x4F1A;&#x63A5;&#x4E0B;&#x53BB;&#x6267;&#x884C;&#x4E0B;&#x4E00;&#x4E2A;<code>case</code>&#x4EE3;&#x7801;&#x5757;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x8DF3;&#x51FA;<code>switch</code>&#x7ED3;&#x6784;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> x = <span class="hljs-number">1</span>;

<span class="hljs-keyword">switch</span> (x) {
  <span class="hljs-keyword">case</span> <span class="hljs-number">1</span>:
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;x &#x7B49;&#x4E8E;1&apos;</span>);
  <span class="hljs-keyword">case</span> <span class="hljs-number">2</span>:
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;x &#x7B49;&#x4E8E;2&apos;</span>);
  <span class="hljs-keyword">default</span>:
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;x &#x7B49;&#x4E8E;&#x5176;&#x4ED6;&#x503C;&apos;</span>);
}
<span class="hljs-comment">// x&#x7B49;&#x4E8E;1</span>
<span class="hljs-comment">// x&#x7B49;&#x4E8E;2</span>
<span class="hljs-comment">// x&#x7B49;&#x4E8E;&#x5176;&#x4ED6;&#x503C;</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;<code>case</code>&#x4EE3;&#x7801;&#x5757;&#x4E4B;&#x4E2D;&#x6CA1;&#x6709;<code>break</code>&#x8BED;&#x53E5;&#xFF0C;&#x5BFC;&#x81F4;&#x4E0D;&#x4F1A;&#x8DF3;&#x51FA;<code>switch</code>&#x7ED3;&#x6784;&#xFF0C;&#x800C;&#x4F1A;&#x4E00;&#x76F4;&#x6267;&#x884C;&#x4E0B;&#x53BB;&#x3002;&#x6B63;&#x786E;&#x7684;&#x5199;&#x6CD5;&#x662F;&#x50CF;&#x4E0B;&#x9762;&#x8FD9;&#x6837;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">switch</span> (x) {
  <span class="hljs-keyword">case</span> <span class="hljs-number">1</span>:
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;x &#x7B49;&#x4E8E;1&apos;</span>);
    <span class="hljs-keyword">break</span>;
  <span class="hljs-keyword">case</span> <span class="hljs-number">2</span>:
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;x &#x7B49;&#x4E8E;2&apos;</span>);
    <span class="hljs-keyword">break</span>;
  <span class="hljs-keyword">default</span>:
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;x &#x7B49;&#x4E8E;&#x5176;&#x4ED6;&#x503C;&apos;</span>);
}
</code></pre>
<p><code>switch</code>&#x8BED;&#x53E5;&#x90E8;&#x5206;&#x548C;<code>case</code>&#x8BED;&#x53E5;&#x90E8;&#x5206;&#xFF0C;&#x90FD;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x8868;&#x8FBE;&#x5F0F;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">switch</span> (<span class="hljs-number">1</span> + <span class="hljs-number">3</span>) {
  <span class="hljs-keyword">case</span> <span class="hljs-number">2</span> + <span class="hljs-number">2</span>:
    f();
    <span class="hljs-keyword">break</span>;
  <span class="hljs-keyword">default</span>:
    neverHappens();
}
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x7684;<code>default</code>&#x90E8;&#x5206;&#xFF0C;&#x662F;&#x6C38;&#x8FDC;&#x4E0D;&#x4F1A;&#x6267;&#x884C;&#x5230;&#x7684;&#x3002;</p>
<p>&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;<code>switch</code>&#x8BED;&#x53E5;&#x540E;&#x9762;&#x7684;&#x8868;&#x8FBE;&#x5F0F;&#xFF0C;&#x4E0E;<code>case</code>&#x8BED;&#x53E5;&#x540E;&#x9762;&#x7684;&#x8868;&#x793A;&#x5F0F;&#x6BD4;&#x8F83;&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#x65F6;&#xFF0C;&#x91C7;&#x7528;&#x7684;&#x662F;&#x4E25;&#x683C;&#x76F8;&#x7B49;&#x8FD0;&#x7B97;&#x7B26;&#xFF08;<code>===</code>&#xFF09;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x76F8;&#x7B49;&#x8FD0;&#x7B97;&#x7B26;&#xFF08;<code>==</code>&#xFF09;&#xFF0C;&#x8FD9;&#x610F;&#x5473;&#x7740;&#x6BD4;&#x8F83;&#x65F6;&#x4E0D;&#x4F1A;&#x53D1;&#x751F;&#x7C7B;&#x578B;&#x8F6C;&#x6362;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> x = <span class="hljs-number">1</span>;

<span class="hljs-keyword">switch</span> (x) {
  <span class="hljs-keyword">case</span> <span class="hljs-literal">true</span>:
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;x &#x53D1;&#x751F;&#x7C7B;&#x578B;&#x8F6C;&#x6362;&apos;</span>);
    <span class="hljs-keyword">break</span>;
  <span class="hljs-keyword">default</span>:
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;x &#x6CA1;&#x6709;&#x53D1;&#x751F;&#x7C7B;&#x578B;&#x8F6C;&#x6362;&apos;</span>);
}
<span class="hljs-comment">// x &#x6CA1;&#x6709;&#x53D1;&#x751F;&#x7C7B;&#x578B;&#x8F6C;&#x6362;</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;&#x7531;&#x4E8E;&#x53D8;&#x91CF;<code>x</code>&#x6CA1;&#x6709;&#x53D1;&#x751F;&#x7C7B;&#x578B;&#x8F6C;&#x6362;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x4F1A;&#x6267;&#x884C;<code>case true</code>&#x7684;&#x60C5;&#x51B5;&#x3002;&#x8FD9;&#x8868;&#x660E;&#xFF0C;<code>switch</code>&#x8BED;&#x53E5;&#x5185;&#x90E8;&#x91C7;&#x7528;&#x7684;&#x662F;&#x201C;&#x4E25;&#x683C;&#x76F8;&#x7B49;&#x8FD0;&#x7B97;&#x7B26;&#x201D;&#xFF0C;&#x8BE6;&#x7EC6;&#x89E3;&#x91CA;&#x8BF7;&#x53C2;&#x8003;&#x300A;&#x8FD0;&#x7B97;&#x7B26;&#x300B;&#x4E00;&#x8282;&#x3002;</p>
<h3 id="&#x4E09;&#x5143;&#x8FD0;&#x7B97;&#x7B26;-">&#x4E09;&#x5143;&#x8FD0;&#x7B97;&#x7B26; ?:</h3>
<p>JavaScript &#x8FD8;&#x6709;&#x4E00;&#x4E2A;&#x4E09;&#x5143;&#x8FD0;&#x7B97;&#x7B26;&#xFF08;&#x5373;&#x8BE5;&#x8FD0;&#x7B97;&#x7B26;&#x9700;&#x8981;&#x4E09;&#x4E2A;&#x8FD0;&#x7B97;&#x5B50;&#xFF09;<code>?:</code>&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x7528;&#x4E8E;&#x903B;&#x8F91;&#x5224;&#x65AD;&#x3002;</p>
<pre><code class="lang-javascript">(&#x6761;&#x4EF6;) ? &#x8868;&#x8FBE;&#x5F0F;<span class="hljs-number">1</span> : &#x8868;&#x8FBE;&#x5F0F;<span class="hljs-number">2</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;&#x5982;&#x679C;&#x201C;&#x6761;&#x4EF6;&#x201D;&#x4E3A;<code>true</code>&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x201C;&#x8868;&#x8FBE;&#x5F0F;1&#x201D;&#x7684;&#x503C;&#xFF0C;&#x5426;&#x5219;&#x8FD4;&#x56DE;&#x201C;&#x8868;&#x8FBE;&#x5F0F;2&#x201D;&#x7684;&#x503C;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> even = (n % <span class="hljs-number">2</span> === <span class="hljs-number">0</span>) ? <span class="hljs-literal">true</span> : <span class="hljs-literal">false</span>;
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;&#x5982;&#x679C;<code>n</code>&#x53EF;&#x4EE5;&#x88AB;2&#x6574;&#x9664;&#xFF0C;&#x5219;<code>even</code>&#x7B49;&#x4E8E;<code>true</code>&#xFF0C;&#x5426;&#x5219;&#x7B49;&#x4E8E;<code>false</code>&#x3002;&#x5B83;&#x7B49;&#x540C;&#x4E8E;&#x4E0B;&#x9762;&#x7684;&#x5F62;&#x5F0F;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> even;
<span class="hljs-keyword">if</span> (n % <span class="hljs-number">2</span> === <span class="hljs-number">0</span>) {
  even = <span class="hljs-literal">true</span>;
} <span class="hljs-keyword">else</span> {
  even = <span class="hljs-literal">false</span>;
}
</code></pre>
<p>&#x8FD9;&#x4E2A;&#x4E09;&#x5143;&#x8FD0;&#x7B97;&#x7B26;&#x53EF;&#x4EE5;&#x88AB;&#x89C6;&#x4E3A;<code>if...else...</code>&#x7684;&#x7B80;&#x5199;&#x5F62;&#x5F0F;&#xFF0C;&#x56E0;&#x6B64;&#x53EF;&#x4EE5;&#x7528;&#x4E8E;&#x591A;&#x79CD;&#x573A;&#x5408;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> myVar;
<span class="hljs-built_in">console</span>.log(
  myVar ?
  <span class="hljs-string">&apos;myVar has a value&apos;</span> :
  <span class="hljs-string">&apos;myVar does not have a value&apos;</span>
)
<span class="hljs-comment">// myVar does not have a value</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x5229;&#x7528;&#x4E09;&#x5143;&#x8FD0;&#x7B97;&#x7B26;&#xFF0C;&#x8F93;&#x51FA;&#x76F8;&#x5E94;&#x7684;&#x63D0;&#x793A;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> msg = <span class="hljs-string">&apos;&#x6570;&#x5B57;&apos;</span> + n + <span class="hljs-string">&apos;&#x662F;&apos;</span> + (n % <span class="hljs-number">2</span> === <span class="hljs-number">0</span> ? <span class="hljs-string">&apos;&#x5076;&#x6570;&apos;</span> : <span class="hljs-string">&apos;&#x5947;&#x6570;&apos;</span>);
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x5229;&#x7528;&#x4E09;&#x5143;&#x8FD0;&#x7B97;&#x7B26;&#xFF0C;&#x5728;&#x5B57;&#x7B26;&#x4E32;&#x4E4B;&#x4E2D;&#x63D2;&#x5165;&#x4E0D;&#x540C;&#x7684;&#x503C;&#x3002;</p>
<h2 id="&#x5FAA;&#x73AF;&#x8BED;&#x53E5;">&#x5FAA;&#x73AF;&#x8BED;&#x53E5;</h2>
<p>&#x5FAA;&#x73AF;&#x8BED;&#x53E5;&#x7528;&#x4E8E;&#x91CD;&#x590D;&#x6267;&#x884C;&#x67D0;&#x4E2A;&#x64CD;&#x4F5C;&#xFF0C;&#x5B83;&#x6709;&#x591A;&#x79CD;&#x5F62;&#x5F0F;&#x3002;</p>
<h3 id="while-&#x5FAA;&#x73AF;">while &#x5FAA;&#x73AF;</h3>
<p><code>While</code>&#x8BED;&#x53E5;&#x5305;&#x62EC;&#x4E00;&#x4E2A;&#x5FAA;&#x73AF;&#x6761;&#x4EF6;&#x548C;&#x4E00;&#x6BB5;&#x4EE3;&#x7801;&#x5757;&#xFF0C;&#x53EA;&#x8981;&#x6761;&#x4EF6;&#x4E3A;&#x771F;&#xFF0C;&#x5C31;&#x4E0D;&#x65AD;&#x5FAA;&#x73AF;&#x6267;&#x884C;&#x4EE3;&#x7801;&#x5757;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">while</span> (&#x6761;&#x4EF6;)
  &#x8BED;&#x53E5;;

<span class="hljs-comment">// &#x6216;&#x8005;</span>
<span class="hljs-keyword">while</span> (&#x6761;&#x4EF6;) &#x8BED;&#x53E5;;
</code></pre>
<p><code>while</code>&#x8BED;&#x53E5;&#x7684;&#x5FAA;&#x73AF;&#x6761;&#x4EF6;&#x662F;&#x4E00;&#x4E2A;&#x8868;&#x8FBE;&#x5F0F;&#xFF0C;&#x5FC5;&#x987B;&#x653E;&#x5728;&#x5706;&#x62EC;&#x53F7;&#x4E2D;&#x3002;&#x4EE3;&#x7801;&#x5757;&#x90E8;&#x5206;&#xFF0C;&#x5982;&#x679C;&#x53EA;&#x6709;&#x4E00;&#x6761;&#x8BED;&#x53E5;&#xFF0C;&#x53EF;&#x4EE5;&#x7701;&#x7565;&#x5927;&#x62EC;&#x53F7;&#xFF0C;&#x5426;&#x5219;&#x5C31;&#x5FC5;&#x987B;&#x52A0;&#x4E0A;&#x5927;&#x62EC;&#x53F7;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">while</span> (&#x6761;&#x4EF6;) {
  &#x8BED;&#x53E5;;
}
</code></pre>
<p>&#x4E0B;&#x9762;&#x662F;<code>while</code>&#x8BED;&#x53E5;&#x7684;&#x4E00;&#x4E2A;&#x4F8B;&#x5B50;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>;

<span class="hljs-keyword">while</span> (i &lt; <span class="hljs-number">100</span>) {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;i &#x5F53;&#x524D;&#x4E3A;&#xFF1A;&apos;</span> + i);
  i = i + <span class="hljs-number">1</span>;
}
</code></pre>
<p>&#x4E0A;&#x9762;&#x7684;&#x4EE3;&#x7801;&#x5C06;&#x5FAA;&#x73AF;100&#x6B21;&#xFF0C;&#x76F4;&#x5230;<code>i</code>&#x7B49;&#x4E8E;100&#x4E3A;&#x6B62;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#x662F;&#x4E00;&#x4E2A;&#x65E0;&#x9650;&#x5FAA;&#x73AF;&#xFF0C;&#x56E0;&#x4E3A;&#x5FAA;&#x73AF;&#x6761;&#x4EF6;&#x603B;&#x662F;&#x4E3A;&#x771F;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">while</span> (<span class="hljs-literal">true</span>) {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Hello, world&apos;</span>);
}
</code></pre>
<h3 id="for-&#x5FAA;&#x73AF;">for &#x5FAA;&#x73AF;</h3>
<p><code>for</code>&#x8BED;&#x53E5;&#x662F;&#x5FAA;&#x73AF;&#x547D;&#x4EE4;&#x7684;&#x53E6;&#x4E00;&#x79CD;&#x5F62;&#x5F0F;&#xFF0C;&#x53EF;&#x4EE5;&#x6307;&#x5B9A;&#x5FAA;&#x73AF;&#x7684;&#x8D77;&#x70B9;&#x3001;&#x7EC8;&#x70B9;&#x548C;&#x7EC8;&#x6B62;&#x6761;&#x4EF6;&#x3002;&#x5B83;&#x7684;&#x683C;&#x5F0F;&#x5982;&#x4E0B;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">for</span> (&#x521D;&#x59CB;&#x5316;&#x8868;&#x8FBE;&#x5F0F;; &#x6761;&#x4EF6;; &#x9012;&#x589E;&#x8868;&#x8FBE;&#x5F0F;)
  &#x8BED;&#x53E5;

<span class="hljs-comment">// &#x6216;&#x8005;</span>

<span class="hljs-keyword">for</span> (&#x521D;&#x59CB;&#x5316;&#x8868;&#x8FBE;&#x5F0F;; &#x6761;&#x4EF6;; &#x9012;&#x589E;&#x8868;&#x8FBE;&#x5F0F;) {
  &#x8BED;&#x53E5;
}
</code></pre>
<p><code>for</code>&#x8BED;&#x53E5;&#x540E;&#x9762;&#x7684;&#x62EC;&#x53F7;&#x91CC;&#x9762;&#xFF0C;&#x6709;&#x4E09;&#x4E2A;&#x8868;&#x8FBE;&#x5F0F;&#x3002;</p>
<ul>
<li>&#x521D;&#x59CB;&#x5316;&#x8868;&#x8FBE;&#x5F0F;&#xFF08;initialize&#xFF09;&#xFF1A;&#x786E;&#x5B9A;&#x5FAA;&#x73AF;&#x53D8;&#x91CF;&#x7684;&#x521D;&#x59CB;&#x503C;&#xFF0C;&#x53EA;&#x5728;&#x5FAA;&#x73AF;&#x5F00;&#x59CB;&#x65F6;&#x6267;&#x884C;&#x4E00;&#x6B21;&#x3002;</li>
<li>&#x6761;&#x4EF6;&#x8868;&#x8FBE;&#x5F0F;&#xFF08;test&#xFF09;&#xFF1A;&#x6BCF;&#x8F6E;&#x5FAA;&#x73AF;&#x5F00;&#x59CB;&#x65F6;&#xFF0C;&#x90FD;&#x8981;&#x6267;&#x884C;&#x8FD9;&#x4E2A;&#x6761;&#x4EF6;&#x8868;&#x8FBE;&#x5F0F;&#xFF0C;&#x53EA;&#x6709;&#x503C;&#x4E3A;&#x771F;&#xFF0C;&#x624D;&#x7EE7;&#x7EED;&#x8FDB;&#x884C;&#x5FAA;&#x73AF;&#x3002;</li>
<li>&#x9012;&#x589E;&#x8868;&#x8FBE;&#x5F0F;&#xFF08;increment&#xFF09;&#xFF1A;&#x6BCF;&#x8F6E;&#x5FAA;&#x73AF;&#x7684;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x64CD;&#x4F5C;&#xFF0C;&#x901A;&#x5E38;&#x7528;&#x6765;&#x9012;&#x589E;&#x5FAA;&#x73AF;&#x53D8;&#x91CF;&#x3002;</li>
</ul>
<p>&#x4E0B;&#x9762;&#x662F;&#x4E00;&#x4E2A;&#x4F8B;&#x5B50;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> x = <span class="hljs-number">3</span>;
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>; i &lt; x; i++) {
  <span class="hljs-built_in">console</span>.log(i);
}
<span class="hljs-comment">// 0</span>
<span class="hljs-comment">// 1</span>
<span class="hljs-comment">// 2</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;&#x521D;&#x59CB;&#x5316;&#x8868;&#x8FBE;&#x5F0F;&#x662F;<code>var i = 0</code>&#xFF0C;&#x5373;&#x521D;&#x59CB;&#x5316;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;<code>i</code>&#xFF1B;&#x6D4B;&#x8BD5;&#x8868;&#x8FBE;&#x5F0F;&#x662F;<code>i &lt; x</code>&#xFF0C;&#x5373;&#x53EA;&#x8981;<code>i</code>&#x5C0F;&#x4E8E;<code>x</code>&#xFF0C;&#x5C31;&#x4F1A;&#x6267;&#x884C;&#x5FAA;&#x73AF;&#xFF1B;&#x9012;&#x589E;&#x8868;&#x8FBE;&#x5F0F;&#x662F;<code>i++</code>&#xFF0C;&#x5373;&#x6BCF;&#x6B21;&#x5FAA;&#x73AF;&#x7ED3;&#x675F;&#x540E;&#xFF0C;<code>i</code>&#x589E;&#x5927;1&#x3002;</p>
<p>&#x6240;&#x6709;<code>for</code>&#x5FAA;&#x73AF;&#xFF0C;&#x90FD;&#x53EF;&#x4EE5;&#x6539;&#x5199;&#x6210;<code>while</code>&#x5FAA;&#x73AF;&#x3002;&#x4E0A;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#x6539;&#x4E3A;<code>while</code>&#x5FAA;&#x73AF;&#xFF0C;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> x = <span class="hljs-number">3</span>;
<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>;

<span class="hljs-keyword">while</span> (i &lt; x) {
  <span class="hljs-built_in">console</span>.log(i);
  i++;
}
</code></pre>
<p><code>for</code>&#x8BED;&#x53E5;&#x7684;&#x4E09;&#x4E2A;&#x90E8;&#x5206;&#xFF08;initialize&#x3001;test&#x3001;increment&#xFF09;&#xFF0C;&#x53EF;&#x4EE5;&#x7701;&#x7565;&#x4EFB;&#x4F55;&#x4E00;&#x4E2A;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x5168;&#x90E8;&#x7701;&#x7565;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">for</span> ( ; ; ){
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Hello World&apos;</span>);
}
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x7701;&#x7565;&#x4E86;<code>for</code>&#x8BED;&#x53E5;&#x8868;&#x8FBE;&#x5F0F;&#x7684;&#x4E09;&#x4E2A;&#x90E8;&#x5206;&#xFF0C;&#x7ED3;&#x679C;&#x5C31;&#x5BFC;&#x81F4;&#x4E86;&#x4E00;&#x4E2A;&#x65E0;&#x9650;&#x5FAA;&#x73AF;&#x3002;</p>
<h3 id="dowhile-&#x5FAA;&#x73AF;">do...while &#x5FAA;&#x73AF;</h3>
<p><code>do...while</code>&#x5FAA;&#x73AF;&#x4E0E;<code>while</code>&#x5FAA;&#x73AF;&#x7C7B;&#x4F3C;&#xFF0C;&#x552F;&#x4E00;&#x7684;&#x533A;&#x522B;&#x5C31;&#x662F;&#x5148;&#x8FD0;&#x884C;&#x4E00;&#x6B21;&#x5FAA;&#x73AF;&#x4F53;&#xFF0C;&#x7136;&#x540E;&#x5224;&#x65AD;&#x5FAA;&#x73AF;&#x6761;&#x4EF6;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">do</span>
  &#x8BED;&#x53E5;
<span class="hljs-keyword">while</span> (&#x6761;&#x4EF6;);

<span class="hljs-comment">// &#x6216;&#x8005;</span>
<span class="hljs-keyword">do</span> {
  &#x8BED;&#x53E5;
} <span class="hljs-keyword">while</span> (&#x6761;&#x4EF6;);
</code></pre>
<p>&#x4E0D;&#x7BA1;&#x6761;&#x4EF6;&#x662F;&#x5426;&#x4E3A;&#x771F;&#xFF0C;<code>do...while</code>&#x5FAA;&#x73AF;&#x81F3;&#x5C11;&#x8FD0;&#x884C;&#x4E00;&#x6B21;&#xFF0C;&#x8FD9;&#x662F;&#x8FD9;&#x79CD;&#x7ED3;&#x6784;&#x6700;&#x5927;&#x7684;&#x7279;&#x70B9;&#x3002;&#x53E6;&#x5916;&#xFF0C;<code>while</code>&#x8BED;&#x53E5;&#x540E;&#x9762;&#x7684;&#x5206;&#x53F7;&#x6CE8;&#x610F;&#x4E0D;&#x8981;&#x7701;&#x7565;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x662F;&#x4E00;&#x4E2A;&#x4F8B;&#x5B50;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> x = <span class="hljs-number">3</span>;
<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>;

<span class="hljs-keyword">do</span> {
  <span class="hljs-built_in">console</span>.log(i);
  i++;
} <span class="hljs-keyword">while</span>(i &lt; x);
</code></pre>
<h3 id="break-&#x8BED;&#x53E5;&#x548C;-continue-&#x8BED;&#x53E5;">break &#x8BED;&#x53E5;&#x548C; continue &#x8BED;&#x53E5;</h3>
<p><code>break</code>&#x8BED;&#x53E5;&#x548C;<code>continue</code>&#x8BED;&#x53E5;&#x90FD;&#x5177;&#x6709;&#x8DF3;&#x8F6C;&#x4F5C;&#x7528;&#xFF0C;&#x53EF;&#x4EE5;&#x8BA9;&#x4EE3;&#x7801;&#x4E0D;&#x6309;&#x65E2;&#x6709;&#x7684;&#x987A;&#x5E8F;&#x6267;&#x884C;&#x3002;</p>
<p><code>break</code>&#x8BED;&#x53E5;&#x7528;&#x4E8E;&#x8DF3;&#x51FA;&#x4EE3;&#x7801;&#x5757;&#x6216;&#x5FAA;&#x73AF;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>;

<span class="hljs-keyword">while</span>(i &lt; <span class="hljs-number">100</span>) {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;i &#x5F53;&#x524D;&#x4E3A;&#xFF1A;&apos;</span> + i);
  i++;
  <span class="hljs-keyword">if</span> (i === <span class="hljs-number">10</span>) <span class="hljs-keyword">break</span>;
}
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x53EA;&#x4F1A;&#x6267;&#x884C;10&#x6B21;&#x5FAA;&#x73AF;&#xFF0C;&#x4E00;&#x65E6;<code>i</code>&#x7B49;&#x4E8E;10&#xFF0C;&#x5C31;&#x4F1A;&#x8DF3;&#x51FA;&#x5FAA;&#x73AF;&#x3002;</p>
<p><code>for</code>&#x5FAA;&#x73AF;&#x4E5F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>break</code>&#x8BED;&#x53E5;&#x8DF3;&#x51FA;&#x5FAA;&#x73AF;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>; i &lt; <span class="hljs-number">5</span>; i++) {
  <span class="hljs-built_in">console</span>.log(i);
  <span class="hljs-keyword">if</span> (i === <span class="hljs-number">3</span>)
    <span class="hljs-keyword">break</span>;
}
<span class="hljs-comment">// 0</span>
<span class="hljs-comment">// 1</span>
<span class="hljs-comment">// 2</span>
<span class="hljs-comment">// 3</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x6267;&#x884C;&#x5230;<code>i</code>&#x7B49;&#x4E8E;3&#xFF0C;&#x5C31;&#x4F1A;&#x8DF3;&#x51FA;&#x5FAA;&#x73AF;&#x3002;</p>
<p><code>continue</code>&#x8BED;&#x53E5;&#x7528;&#x4E8E;&#x7ACB;&#x5373;&#x7EC8;&#x6B62;&#x672C;&#x8F6E;&#x5FAA;&#x73AF;&#xFF0C;&#x8FD4;&#x56DE;&#x5FAA;&#x73AF;&#x7ED3;&#x6784;&#x7684;&#x5934;&#x90E8;&#xFF0C;&#x5F00;&#x59CB;&#x4E0B;&#x4E00;&#x8F6E;&#x5FAA;&#x73AF;&#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>;

<span class="hljs-keyword">while</span> (i &lt; <span class="hljs-number">100</span>){
  i++;
  <span class="hljs-keyword">if</span> (i % <span class="hljs-number">2</span> === <span class="hljs-number">0</span>) <span class="hljs-keyword">continue</span>;
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;i &#x5F53;&#x524D;&#x4E3A;&#xFF1A;&apos;</span> + i);
}
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x53EA;&#x6709;&#x5728;<code>i</code>&#x4E3A;&#x5947;&#x6570;&#x65F6;&#xFF0C;&#x624D;&#x4F1A;&#x8F93;&#x51FA;<code>i</code>&#x7684;&#x503C;&#x3002;&#x5982;&#x679C;<code>i</code>&#x4E3A;&#x5076;&#x6570;&#xFF0C;&#x5219;&#x76F4;&#x63A5;&#x8FDB;&#x5165;&#x4E0B;&#x4E00;&#x8F6E;&#x5FAA;&#x73AF;&#x3002;</p>
<p>&#x5982;&#x679C;&#x5B58;&#x5728;&#x591A;&#x91CD;&#x5FAA;&#x73AF;&#xFF0C;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x7684;<code>break</code>&#x8BED;&#x53E5;&#x548C;<code>continue</code>&#x8BED;&#x53E5;&#x90FD;&#x53EA;&#x9488;&#x5BF9;&#x6700;&#x5185;&#x5C42;&#x5FAA;&#x73AF;&#x3002;</p>
<h3 id="&#x6807;&#x7B7E;&#xFF08;label&#xFF09;">&#x6807;&#x7B7E;&#xFF08;label&#xFF09;</h3>
<p>JavaScript &#x8BED;&#x8A00;&#x5141;&#x8BB8;&#xFF0C;&#x8BED;&#x53E5;&#x7684;&#x524D;&#x9762;&#x6709;&#x6807;&#x7B7E;&#xFF08;label&#xFF09;&#xFF0C;&#x76F8;&#x5F53;&#x4E8E;&#x5B9A;&#x4F4D;&#x7B26;&#xFF0C;&#x7528;&#x4E8E;&#x8DF3;&#x8F6C;&#x5230;&#x7A0B;&#x5E8F;&#x7684;&#x4EFB;&#x610F;&#x4F4D;&#x7F6E;&#xFF0C;&#x6807;&#x7B7E;&#x7684;&#x683C;&#x5F0F;&#x5982;&#x4E0B;&#x3002;</p>
<pre><code class="lang-javascript">label:
  &#x8BED;&#x53E5;
</code></pre>
<p>&#x6807;&#x7B7E;&#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x610F;&#x7684;&#x6807;&#x8BC6;&#x7B26;&#xFF0C;&#x4F46;&#x4E0D;&#x80FD;&#x662F;&#x4FDD;&#x7559;&#x5B57;&#xFF0C;&#x8BED;&#x53E5;&#x90E8;&#x5206;&#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x610F;&#x8BED;&#x53E5;&#x3002;</p>
<p>&#x6807;&#x7B7E;&#x901A;&#x5E38;&#x4E0E;<code>break</code>&#x8BED;&#x53E5;&#x548C;<code>continue</code>&#x8BED;&#x53E5;&#x914D;&#x5408;&#x4F7F;&#x7528;&#xFF0C;&#x8DF3;&#x51FA;&#x7279;&#x5B9A;&#x7684;&#x5FAA;&#x73AF;&#x3002;</p>
<pre><code class="lang-javascript">top:
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>; i &lt; <span class="hljs-number">3</span>; i++){
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> j = <span class="hljs-number">0</span>; j &lt; <span class="hljs-number">3</span>; j++){
      <span class="hljs-keyword">if</span> (i === <span class="hljs-number">1</span> &amp;&amp; j === <span class="hljs-number">1</span>) <span class="hljs-keyword">break</span> top;
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;i=&apos;</span> + i + <span class="hljs-string">&apos;, j=&apos;</span> + j);
    }
  }
<span class="hljs-comment">// i=0, j=0</span>
<span class="hljs-comment">// i=0, j=1</span>
<span class="hljs-comment">// i=0, j=2</span>
<span class="hljs-comment">// i=1, j=0</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E3A;&#x4E00;&#x4E2A;&#x53CC;&#x91CD;&#x5FAA;&#x73AF;&#x533A;&#x5757;&#xFF0C;<code>break</code>&#x547D;&#x4EE4;&#x540E;&#x9762;&#x52A0;&#x4E0A;&#x4E86;<code>top</code>&#x6807;&#x7B7E;&#xFF08;&#x6CE8;&#x610F;&#xFF0C;<code>top</code>&#x4E0D;&#x7528;&#x52A0;&#x5F15;&#x53F7;&#xFF09;&#xFF0C;&#x6EE1;&#x8DB3;&#x6761;&#x4EF6;&#x65F6;&#xFF0C;&#x76F4;&#x63A5;&#x8DF3;&#x51FA;&#x53CC;&#x5C42;&#x5FAA;&#x73AF;&#x3002;&#x5982;&#x679C;<code>break</code>&#x8BED;&#x53E5;&#x540E;&#x9762;&#x4E0D;&#x4F7F;&#x7528;&#x6807;&#x7B7E;&#xFF0C;&#x5219;&#x53EA;&#x80FD;&#x8DF3;&#x51FA;&#x5185;&#x5C42;&#x5FAA;&#x73AF;&#xFF0C;&#x8FDB;&#x5165;&#x4E0B;&#x4E00;&#x6B21;&#x7684;&#x5916;&#x5C42;&#x5FAA;&#x73AF;&#x3002;</p>
<p>&#x6807;&#x7B7E;&#x4E5F;&#x53EF;&#x4EE5;&#x7528;&#x4E8E;&#x8DF3;&#x51FA;&#x4EE3;&#x7801;&#x5757;&#x3002;</p>
<pre><code class="lang-javascript">foo: {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-number">1</span>);
  <span class="hljs-keyword">break</span> foo;
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x672C;&#x884C;&#x4E0D;&#x4F1A;&#x8F93;&#x51FA;&apos;</span>);
}
<span class="hljs-built_in">console</span>.log(<span class="hljs-number">2</span>);
<span class="hljs-comment">// 1</span>
<span class="hljs-comment">// 2</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x6267;&#x884C;&#x5230;<code>break foo</code>&#xFF0C;&#x5C31;&#x4F1A;&#x8DF3;&#x51FA;&#x533A;&#x5757;&#x3002;</p>
<p><code>continue</code>&#x8BED;&#x53E5;&#x4E5F;&#x53EF;&#x4EE5;&#x4E0E;&#x6807;&#x7B7E;&#x914D;&#x5408;&#x4F7F;&#x7528;&#x3002;</p>
<pre><code class="lang-javascript">top:
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>; i &lt; <span class="hljs-number">3</span>; i++){
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> j = <span class="hljs-number">0</span>; j &lt; <span class="hljs-number">3</span>; j++){
      <span class="hljs-keyword">if</span> (i === <span class="hljs-number">1</span> &amp;&amp; j === <span class="hljs-number">1</span>) <span class="hljs-keyword">continue</span> top;
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;i=&apos;</span> + i + <span class="hljs-string">&apos;, j=&apos;</span> + j);
    }
  }
<span class="hljs-comment">// i=0, j=0</span>
<span class="hljs-comment">// i=0, j=1</span>
<span class="hljs-comment">// i=0, j=2</span>
<span class="hljs-comment">// i=1, j=0</span>
<span class="hljs-comment">// i=2, j=0</span>
<span class="hljs-comment">// i=2, j=1</span>
<span class="hljs-comment">// i=2, j=2</span>
</code></pre>
<p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;<code>continue</code>&#x547D;&#x4EE4;&#x540E;&#x9762;&#x6709;&#x4E00;&#x4E2A;&#x6807;&#x7B7E;&#x540D;&#xFF0C;&#x6EE1;&#x8DB3;&#x6761;&#x4EF6;&#x65F6;&#xFF0C;&#x4F1A;&#x8DF3;&#x8FC7;&#x5F53;&#x524D;&#x5FAA;&#x73AF;&#xFF0C;&#x76F4;&#x63A5;&#x8FDB;&#x5165;&#x4E0B;&#x4E00;&#x8F6E;&#x5916;&#x5C42;&#x5FAA;&#x73AF;&#x3002;&#x5982;&#x679C;<code>continue</code>&#x8BED;&#x53E5;&#x540E;&#x9762;&#x4E0D;&#x4F7F;&#x7528;&#x6807;&#x7B7E;&#xFF0C;&#x5219;&#x53EA;&#x80FD;&#x8FDB;&#x5165;&#x4E0B;&#x4E00;&#x8F6E;&#x7684;&#x5185;&#x5C42;&#x5FAA;&#x73AF;&#x3002;</p>
<h2 id="&#x53C2;&#x8003;&#x94FE;&#x63A5;">&#x53C2;&#x8003;&#x94FE;&#x63A5;</h2>
<ul>
<li>Axel Rauschmayer, <a href="http://www.2ality.com/2011/10/javascript-overview.html" target="_blank" rel="nofollow">A quick overview of JavaScript</a></li>
</ul>




<footer class="page-footer-ex"> <span class="page-footer-ex-copyright"> <a href="https://xiaobaiai.net" target="_blank" rel="nofollow">&#x5C0F;&#x767D;AI.&#x6613;&#x540D;</a>, &#x4F7F;&#x7528;<a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="nofollow">&#x77E5;&#x8BC6;&#x5171;&#x4EAB; 4.0 &#x534F;&#x8BAE;&#x53D1;&#x5E03;</a>&#x53D1;&#x5E03; </span> &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; <span class="page-footer-ex-footer-update"> <i>&#x9875;&#x9762;&#x4FEE;&#x8BA2;&#x4E8E;&#xFF1A;</i> 2019-08-22 16:53:02 </span> </footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="history.html" class="navigation navigation-prev " aria-label="Previous page: 历史">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../types/" class="navigation navigation-next " aria-label="Next page: 数据类型">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"基本语法","level":"1.2.3","depth":2,"next":{"title":"数据类型","level":"1.3","depth":1,"path":"docs/types/README.md","ref":"docs/types/README.md","articles":[{"title":"概述","level":"1.3.1","depth":2,"path":"docs/types/general.md","ref":"docs/types/general.md","articles":[]},{"title":"null,undefined和布尔值","level":"1.3.2","depth":2,"path":"docs/types/null-undefined-boolean.md","ref":"docs/types/null-undefined-boolean.md","articles":[]},{"title":"数值","level":"1.3.3","depth":2,"path":"docs/types/number.md","ref":"docs/types/number.md","articles":[]},{"title":"字符串","level":"1.3.4","depth":2,"path":"docs/types/string.md","ref":"docs/types/string.md","articles":[]},{"title":"对象","level":"1.3.5","depth":2,"path":"docs/types/object.md","ref":"docs/types/object.md","articles":[]},{"title":"函数","level":"1.3.6","depth":2,"path":"docs/types/function.md","ref":"docs/types/function.md","articles":[]},{"title":"数组","level":"1.3.7","depth":2,"path":"docs/types/array.md","ref":"docs/types/array.md","articles":[]}]},"previous":{"title":"历史","level":"1.2.2","depth":2,"path":"docs/basic/history.md","ref":"docs/basic/history.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-sharing","chapter-fold","back-to-top-button","search-pro","sharing-plus","myseo","favicon","page-footer-ex","search-pro","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"chapter-fold":{},"livereload":{},"page-footer-ex":{"copyright":"<a href='https://xiaobaiai.net' target='_blank'>小白AI.易名</a>, 使用<a href='https://creativecommons.org/licenses/by-sa/4.0/' target='_blank'>知识共享 4.0 协议发布</a>发布","markdown":false,"update_format":"YYYY-MM-DD HH:mm:ss","update_label":"<i>页面修订于：</i>"},"search-pro":{},"search":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"myseo":{"description":"Javascript教程","keywords":"小白AI.易名,xiaobaiai.net,Javascript,入门,教程,博客","titlePrefix":"Javascript教程 - ","titleSuffix":" - 小白AI.易名"},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"favicon":{"shortcut":"assets/images/favicon.ico","bookmark":"assets/images/favicon.ico","appleTouch":"assets/images/apple-touch-icon.png","appleTouchMore":{"120x120":"assets/images/apple-touch-icon-120x120.png","180x180":"assets/images/apple-touch-icon-180x180.png"}},"back-to-top-button":{},"sharing":{"qq":true,"all":["qq","qzone","twitter","weibo","linkedin"],"douban":false,"facebook":true,"weibo":true,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":true,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"小白AI.易名","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"language":"zh-hans","gitbook":"*","description":"Javascript教程"},"file":{"path":"docs/basic/grammar.md","mtime":"2019-08-22T08:53:02.284Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-08-28T05:00:46.673Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

